//
//  CheckboxHeaderView.m
//  MoneyIndividual
//
//  Created by Le Anh Tai on 1/9/14.
//  Copyright (c) 2014 Le Anh Tai. All rights reserved.
//


#import "CheckboxHeaderView.h"
@implementation CheckboxHeaderView

#pragma mark - Lifecycle
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        // Initialization code
        _checkBox = [[CTCheckbox alloc] init];
        [_checkBox addTarget:self action:@selector(checkboxDidChanged:) forControlEvents:UIControlEventValueChanged];
        
        [self addSubview:_checkBox];
    }
    
    return self;
}

#pragma mark - Logic function
- (void)setTitle:(NSString *)title
{
    _checkBox.textLabel.text = title;
}

- (void)setFrame:(CGRect)frame
{
    [super setFrame:frame];
    
    _checkBox.frame = CGRectMake(10, 0, frame.size.width - 10, frame.size.height);
}

#pragma mark - Delegate
- (void)checkboxDidChanged:(CTCheckbox *)checkbox
{
    if (checkbox.checked)
    {
        
    }
}

@end
